package com.heima.article.controller.v1;

import com.heima.article.service.ArticleService;
import com.heima.model.article.dto.ArticleDto;
import com.heima.model.common.dto.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/article")
@Slf4j
public class ArticleController {
    @Autowired
    private ArticleService articleService;

    @PostMapping("/save")
    public ResponseResult save(@RequestBody ArticleDto articleDto) {
        log.info("save articleDto:{}", articleDto);
        return articleService.saveArticle(articleDto);
    }
}
